package com.example.demodb.controller;

import com.example.demodb.entity.CommonResult;
import com.example.demodb.entity.CarbonArticleContent;
import com.example.demodb.service.CarbonArticleContentService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class CarbonArticleContentController {
    @Resource
    private CarbonArticleContentService carbonArticleContentService;

//    @PostMapping("/CarbonArticleContentController/findUserByAccountNameAndPassword")
//    @CrossOrigin
//    public CommonResult<CarbonArticleContent> findUserByAccountNameAndPassword(@RequestBody CarbonArticleContent carbonArticleContent){
//        CarbonArticleContent sa = carbonArticleContentService.findUserByAccountNameAndPassword(carbonArticleContent);
//        if(sa == null){
//            return new CommonResult<>(404,"用户名或密码错误",null);
//        }
//        return new CommonResult<>(200,"登陆成功",sa);
//    }
//
//
//
    @GetMapping("/CarbonArticleContentController/findTop15")
    @CrossOrigin
    public List<CarbonArticleContent> findTop15(){
        return carbonArticleContentService.findTop15();
    }
//
//    @PostMapping("/CarbonArticleContentController/addCarbonArticleContent")
//    @CrossOrigin
//    public CommonResult<CarbonArticleContent> addCarbonArticleContent(@RequestBody CarbonArticleContent carbonArticleContent){
//        CarbonArticleContent sa = carbonArticleContentService.addCarbonArticleContent(carbonArticleContent);
//        if(sa == null){
//            return new CommonResult<>(404,"注册失败，用户名或手机号重复",null);
//        }
//        return new CommonResult<>(200,"注册成功",sa);
//    }
}
